/**
 *
 */
package hichecker.ui.components.file_chooser;

import hichecker.controller.Config;
import hichecker.ui.components.icon_factory.IconFactory;

import javax.swing.JOptionPane;

/**
 *
 */
public class SaveFileChooser extends AbstractFileChooser {

	public SaveFileChooser(FileType type, String title) {
		super(type, title);
	}

	@Override
    public void approveSelection() {
		if (getSelectedFile().exists()) {
			int result = JOptionPane.showConfirmDialog(this,
					Config.DIALOG_CONFIRM_OVERWRITE,
					Config.DIALOG_CONFIRM_OVERWRITE_HEADER, JOptionPane.YES_NO_OPTION,
					JOptionPane.WARNING_MESSAGE, IconFactory
							.getIcon(IconFactory.IconType.WARNING));
			if (result != JOptionPane.YES_OPTION) return;
		}
    	super.approveSelection();
    }

}